/**
 * 拜访记录审批--领导评论
 *
 * create by wenchuan.li 2018/11/16
 *
 */
define(function () {

    var self,
        searchData = {
            keyword: ''
        }
    ;

    var gwat171 = app.Module.extend({

        init: function () {
            self = this;
            self._super({
                _refreshAutoInit: true //自动加载刷新控件
            }, win);
        },
        _initRefresh: function () { // 实例化刷新组件
            if (self._refreshIds.length == 0) {
                self._refreshIds = ['scrollNY'];
            }
            this._super(win);
        },
        _refreshCb: function (goods) {// 刷新组件回调函授
            var _super = this._super;
            app.ajax({
                xurl: "api/wx/gwat171/getGwbhData",
                xdata: {
                    page:goods.page+1,
                    limit: goods.limit,
                    GWBHACTI: goods.type.replace('scroll', ''),
                    keyword: searchData.keyword
                },
                cb: function (result) {
                    if (result.ok) {
                        var data = result.data;
                        _super({
                            obj: goods,
                            data: data.data.addMap({checked:false}),
                            nodata: '无商机主题...'
                        });
                    }
                }
            });
        },
        _search:function (data) {
            searchData.keyword = data.keyword.trim();
            self._refresh();
        },
        _lazy: function () {
            this._super();
        },
        _ready: function () {
            Vue.component('gwat171-1-listitem', {
                template: app.getByid(doc, 'item-template'),
                props: {
                    model: Array,
                    other: Object
                },
                methods: {
                    statueImg: function (item) {
                        if (item.GWBHACTI == 'Y') {
                            return 'comfirom';
                        } else if (item.GWBHACTI == 'N') {
                            return 'nonComfirom';
                        } else {
                            return '';
                        }
                    },
                    showDetail: function (item) {
                        app.openPage({
                            src: "gwat171_1/gwat171_1-info.html",
                            args: item
                        });
                    }
                }
            });
        }
    });

    new gwat171();

});